const apiUrl = "https://h5.watsons.com.cn";

//数据获取的封装
const pageData = {
  mianmo(callback, pageId) {//面膜列表数据
    wx.request({

      //https://h5.watsons.com.cn/item/ws/group_list?current_page=2&page_size=24&group_id=11843&device_id=0e17bfe0-f43d-11e8-88db-bda7062eb88c
      //https://h5.watsons.com.cn/item/ws/group_list?current_page=1&page_size=24&group_id=11831&device_id=0e17bfe0-f43d-11e8-88db-bda7062eb88c
      url: `${apiUrl}/item/ws/group_list?current_page=${pageId}&page_size=24&group_id=11831&device_id=0e17bfe0-f43d-11e8-88db-bda7062eb88c`,
      //仅为示例，并非真实的接口地址

      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        callback('success', res);
      }
    })
  },
  meizhuang(callback,pageId) {//面膜列表数据
    wx.request({

      //https://h5.watsons.com.cn/item/ws/group_list?current_page=2&page_size=24&group_id=11843&device_id=0e17bfe0-f43d-11e8-88db-bda7062eb88c
      url: `${apiUrl}/item/ws/group_list?current_page=${pageId}&page_size=24&group_id=11843&device_id=0e17bfe0-f43d-11e8-88db-bda7062eb88c`,
      //仅为示例，并非真实的接口地址

      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        callback('success', res);
      }
    })
  },
  //获取某一个商品的数据
  //id 商品id号
  item(callback,id) {//获取时尚数据
    wx.request({
      url: `${apiUrl}/item/reviews/list?item_id=${id}&count=1&offset=0`,
      //仅为示例，并非真实的接口地址

      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        callback('success', res);
      }
    })
  }


}


//输出
module.exports={
  pageData
}